package com.ja.openchat.viewmodels;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.blankj.utilcode.util.ActivityUtils;
import com.ja.openchat.ui.chat.redpacket.RedPacketDetailActivity;
import com.zy.openchat.core.model.redpacket.RedPacketInfo;

import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

//红包记录通用布局
public class RedPacketRecordMiddleViewModel extends MultiItemViewModel<RedPacketRecordViewModel> {
    public ObservableField<RedPacketInfo> text = new ObservableField<>();
    public int recordType;

    public RedPacketRecordMiddleViewModel(@NonNull RedPacketRecordViewModel application, RedPacketInfo text, int recordType) {
        super(application);
        this.recordType = recordType;
        this.text.set(text);
    }

    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            RedPacketDetailActivity.startActivity(ActivityUtils.getTopActivity(),text.get());
        }
    });
}
